package com.lurencun.android.topicbank.entity;

import java.util.List;

import com.lurencun.android.topicbank.presist.Topic;

public class TopicJsonEntity {
	/** 问题ID **/
	private Long topicId;

	/** 序号 **/
	private int index;

	/** 问题类型 **/
	private int type;

	/** 问题题干 **/
	private String title;

	/** 图片 **/
	private String image;

	private List<AnswerJsonEntity> answers;

	private SolutionJsonEntity solutions;
	
	private TechniqueJsonEntity techniques;

	public Long getTopicId() {
		return topicId;
	}

	public void setTopicId(Long topicId) {
		this.topicId = topicId;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public List<AnswerJsonEntity> getAnswers() {
		return answers;
	}

	public void setAnswers(List<AnswerJsonEntity> answers) {
		this.answers = answers;
	}

	public SolutionJsonEntity getSolutions() {
		return solutions;
	}

	public void setSolutions(SolutionJsonEntity solutions) {
		this.solutions = solutions;
	}

	public TechniqueJsonEntity getTechniques() {
		return techniques;
	}

	public void setTechniques(TechniqueJsonEntity techniques) {
		this.techniques = techniques;
	}

	public Topic transform() {
		Topic topic = new Topic();
		topic.setImage(image);
		topic.setIndex(index);
		topic.setTitle(title);
		topic.setTopicId(topicId);
		topic.setType(type);
		return topic;
	}

	public boolean isValid() {
		return this.topicId!=null && this.topicId > 0 && this.title!=null && !this.title.equals("");
	}
	
}
